﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace NLBS.Web.UI
{
   public class ControlCommand:ICommand
    {
       private string controlName;
       private CallBackBase callback;
       private System.Web.UI.Control control;
       public ControlCommand(string control,CallBackBase callBack)
       {
           this.controlName = control;
           this.callback = callBack;
       }

       public ControlCommand(System.Web.UI.Control control, CallBackBase callBack)
       {
           this.control = control;
           this.callback = callBack;
       }
        #region ICommand Members

        public void Excute()
        {
            if (String.IsNullOrEmpty(controlName))
            {
                callback.LoadControl(control);
            }
            else
            {
                //HttpContext.Current.Server.MapPath()
                callback.LoadControl(controlName);
            }
        }

        #endregion
    }
}
